home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Various / DevDisk 65 (1989)(DevWare PD).zip / DevDisk 65 (1989)(DevWare PD).adf / prosuite / xtext.doc < prev    next >
Text File  |  1990-07-11  |  27KB  |  662 lines

  1.  
  2. XText Programmer's Guide
  3. From the Amiga Programmer's Suite Book 1, by RJ Mical
  4. Copyright (C) 1986, 1987, Robert J. Mical
  5.  
  6.  
  7.  
  8. The document is a programmer's guide to the XText routines.
  9. The main sections of this document are:
  10.  
  11.         o  XTEXT INTRODUCTION 
  12.  
  13.         o  XTEXT PROGRAMMER'S REFERENCE 
  14.  
  15.         o  XTEXT TECHNICAL REFERENCE 
  16.  
  17.         o  XTEXT FUNCTION CALLS 
  18.  
  19.  
  20.  
  21.  
  22. =============================================================================
  23. === XTEXT INTRODUCTION ======================================================
  24. =============================================================================
  25.  
  26. The XText routines have one purpose:  extra-fast text.  XText is 
  27. intended for Amiga programmers who want high-performance text and 
  28. are willing to pay for it.  The cost:  extra memory usage and fewer 
  29. text features.  What you get for your investment:  brute force 
  30. text rendering so fast it singes your eyelashes.
  31.  
  32. The XText routines attempt to answer a need not satisfied by the 
  33. Amiga graphics library's Text() routine.  The Text() routine is a 
  34. very good, economical, general purpose text generator.  It handles 
  35. many special text features and uses the graphics library functions 
  36. and structures in the correct system way.  It obeys all the Amiga 
  37. rules of system decency and strives to keep its memory requirements 
  38. to an absolute minimum.  You can use the Text() routine to create 
  39. text that ranges from the plain to the fantastically fancy.  
  40.  
  41. What you can't do with the Text() routine is create very simple text 
  42. that avoids the graphics library overhead and that skips its own 
  43. overhead by abandoning fancy features and economy in favor of speed.  
  44.  
  45. The XText routines try to avoid as much system overhead as possible.  
  46. Wherever appropriate, XText uses memory to gain efficiency.  It 
  47. foregoes features such as proportional-width fonts and kerning in 
  48. favor of rendering speed.  It also short-circuits the graphics 
  49. library by going directly to the blitter to create the text (though 
  50. it does so in a system-honest fashion).  
  51.  
  52. The XText routines have some limitations and drawbacks.  The only 
  53. fonts that XText handles are fixed-width at 8 bits wide, with no 
  54. overlap between characters.  If you want fancy algorithmic styles 
  55. like underlining, bold, and italics you have to pay for them by 
  56. expending RAM, and the cost is significant:  typically 2K or 4K of 
  57. RAM for each style of text.  Also, algorithmic styles take about 
  58. one second each for initial setup.  Italics don't look as good as 
  59. they do when created by the Text() routine, because the italicized 
  60. character must still fit in an 8-wide character cel (although you 
  61. can get around this problem by creating your own italics font).
  62.  
  63. But though the cost of XText is significant, the benefit is 
  64. significant too:  regardless of the font, regardless of the 
  65. algorithmic style, XText() outputs characters to a Workbench 
  66. window at approximately 18,500 characters per second in the 
  67. fast fat mode, and 14,500 per second in slow slim mode.  
  68. By comparison, the Text() routine outputs characters at 
  69. approximately 3,800 per second, depending on what algorithmic 
  70. style you've selected (4,000 if plain text is selected).
  71.  
  72. For those who have the memory to spare, XText provides a 
  73. high-performance alternative to normal Amiga text rendering.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. =============================================================================
  80. === XTEXT PROGRAMMER'S REFERENCE ============================================
  81. =============================================================================
  82.  
  83. This section describes how programmers use the XText routines.
  84.  
  85. An important note:  if you are using the Metacomco assembler when 
  86. compiling .asm files, you must comment out the definition of the 
  87. constant AZTEC in the xtext.i file.  If you are using the Aztec 
  88. assembler, you must define the constant named AZTEC in the xtext.i 
  89. file.  This is because the Aztec assembler uses some non-standard 
  90. syntax, so special steps must be taken to define things correctly.
  91.  
  92.  
  93.  
  94. === Plain XText Usage =======================================================
  95.  
  96. Using basic XText is actually quite simple.
  97.  
  98. The XText() routine requires an initialized XTextSupport structure 
  99. to do its work.  You get an XTextSupport structure by calling the 
  100. MakeXTextSupport() routine.  This routine allocates an XTextSupport 
  101. structure for you and initializes it such that if all you want to 
  102. do is create plain text, you can use the support structure as is.  
  103.  
  104. The MakeXTextSupport() routine accepts an argument of note:  the 
  105. address of a TextAttr structure.  You use this argument to specify 
  106. the font to be used with your calls to XText().  With this argument 
  107. you can specify that the XText() routine will use a disk-based font 
  108. rather than the system's topaz.font.  You can use any 8-bit wide 
  109. font, even a font of your own design!
  110.  
  111. Once you've gotten an XTextSupport structure from MakeXTextSupport(), 
  112. you create text by calling the XText() routine.  The arguments to 
  113. the XText() routine are simple; refer to the XText() autodoc header 
  114. for details.
  115.  
  116. If you like, you can set FrontPen, BackPen and DrawMode in your 
  117. XTextSupport structure before you call XText().  The characters 
  118. normally are rendered in the FrontPen color.  The space around 
  119. the characters is rendered in the BackPen color.  The FrontPen is 
  120. initialized to 1 and the BackPen to 0, but you can change them to 
  121. anything you prefer.  The DrawMode works according to the DrawMode 
  122. rules as illuminated in the Text chapter of the ROM Kernel Manual.  
  123. Briefly:
  124.  
  125.              Draw Mode   Result
  126. ----------------------   ---------------------------------------------------
  127.                   JAM2   Normal text, overwrites everything
  128.                   JAM1   Overstrike text, writes only the character imagery
  129.             COMPLEMENT   Where there's character imagery, xor's background
  130.       JAM2 + INVERSVID   Normal text, pens reversed
  131.       JAM1 + INVERSVID   Writes blanks around character imagery in FrontPen
  132. COMPLEMENT + INVERSVID   Kind of a weird reverse exclusive-or
  133.  
  134.  
  135. Text clipping works like it does with the Text() routine, which is 
  136. to say that text clips fine with Intuition windows and doesn't clip 
  137. at all with graphics rastports that you create yourself.
  138.  
  139.  
  140. When you're done calling XText() (usually when your program is 
  141. terminating), you call UnmakeXTextSupport() to deallocate your 
  142. XTextSupport structure and all of the resources associated with it.
  143.  
  144. And that's it!  Easy, eh?
  145.  
  146.  
  147.  
  148. === Advanced XText Techniques ===============================================
  149.  
  150. When you call MakeXTextSupport() you get to preset the Flags variable 
  151. of your new XTextSupport structure before anything else is done with the 
  152. structure.  Mostly notably, you can preset the SLIM_XTEXT flag.  
  153. The SLIM_XTEXT flag allows you to specify that you want the slower, slimmer 
  154. XText technique, which uses half as much memory as the faster, fatter 
  155. XText technique but runs about 20% slower.
  156.  
  157.  
  158. If you want to have algorithmic styles for your text, you must create 
  159. them with calls to the MakeXTextFont() routine after you've gotten 
  160. an XTextSupport structure.
  161.  
  162. To do this, you start with an initialized TextAttr structure.  
  163. Set the TextAttr's ta_Style field to the font attributes you want; 
  164. your choices are combinations of FSF_BOLD, FSF_UNDERLINED and FSF_ITALIC.  
  165. Then call MakeXTextFont() with the address of this TextAttr and the 
  166. address of your XTextSupport structure, along with a font select 
  167. index.  The font select index will be used to save the new font data 
  168. pointer in the XTextSupport's FontData[] array.
  169.  
  170. Later, before calling XText(), you can set the XTextSupport variable 
  171. FontSelect to describe which of the fonts you want used for the 
  172. subsequent XText() calls.
  173.  
  174. You find the FontSelect definitions in xtext.h.  They have names 
  175. like NORMAL_FONT, ULINE_FONT, and ITALIC_BOLD_FONT.  Of course 
  176. there's also the ever-popular ITALIC_ULINE_BOLD_FONT if you need 
  177. it, though this font tends to look as muddy as the name.
  178.  
  179. Actually, the FontSelect definitions are just names for the indices 
  180. into the FontData[] array.  You can make up your own names if you 
  181. like.  Also, when calling MakeXTextFont(), you can have the TextAttr 
  182. refer to different fonts or any combination of fonts and styles.  
  183. It's up to you!  All XText expects is that FontSelect has a valid 
  184. index into FontData[].
  185.  
  186. By the way, the MakeXTextSupport() routine initializes the entire 
  187. FontData[] array with the address of the NORMAL_FONT structure, so 
  188. if you make a mistake and select a font that you hadn't initialized 
  189. you'll get plain text.
  190.  
  191. If you want, there's no restriction against creating multiple 
  192. XTextSupport structures to support multiple fonts.
  193.  
  194.  
  195. Italics are a problem.  The italics of a normal font are skewed 
  196. such that they cover more than 8 bits of character imagery.  As only 
  197. 8 bits of the final imagery can be used, a decision has to be made 
  198. regarding which of the 8 bits will be used.  The default is defined 
  199. by the constant ITALIC_LEFT_EDGE, which describes the first column of 
  200. bits on the left that will be used for the final imagery.  If you 
  201. don't like how your italics look, you can try playing with the value 
  202. of this constant.
  203.  
  204.  
  205. Part of the XText speed is achieved by having a pre-initialized BitMap 
  206. in the XTextSupport structure.  If you're ever going to change the 
  207. OutputRPort pointer in your support structure, you must re-initialize 
  208. the TextBitMap.
  209.  
  210.  
  211. One last note:  in the XTextSupport structure is a Remember key, which 
  212. is used to track all of the memory allocations required to support 
  213. your XText usage.  You can use this key to make further allocations 
  214. as needed.  FreeRemember() is called with this key when you call 
  215. UnmakeXTextSupport().
  216.  
  217.  
  218.  
  219.  
  220. =============================================================================
  221. === XTEXT TECHNICAL REFERENCE ===============================================
  222. =============================================================================
  223.  
  224. This section presents a tutorial of how the XText() routine works.  
  225. It is meant to augment a reading of the xtext.asm file.  Maybe you can 
  226. learn something about pushing that old Amiga around!
  227.  
  228.  
  229.  
  230. === XText Theory of Operation ===============================================
  231.  
  232. The XText theory is relatively simple.  It's all brute force and shortcuts.
  233.  
  234. The characters are restricted to a width of exactly 8 bits.  This allows 
  235. character imagery to be handled as byte-sized quantities, which is a 
  236. very handy quantity for the Amiga to use.  You might think that the 
  237. 68000 is employed to move the data around, but a further minor 
  238. requirement -- namely that all buffers must be an even number of 
  239. bytes wide -- allows the brute force of the blitter to assist in 
  240. blasting the text into the display.  
  241.  
  242. To create a line of text, XText uses shortcut techniques to quickly 
  243. construct a bitmap that represents the text.  
  244.  
  245. XText starts by building a single plane of normal character imagery 
  246. (character data bits set, background bits clear) in an imagery plane 
  247. called the NormalTextPlane.  This plane is built one of two ways:  
  248. the normal technique uses a word of data for each byte of character 
  249. imagery in order to utilize the blitter when building the 
  250. NormalTextPlane; the "slim" technique which uses the only a byte of 
  251. data for each byte of character imagery and uses the processor to 
  252. build the NormalTextPlane.  The actual mechanics of this is described 
  253. in detail below.  
  254.  
  255. As needed, the NormalTextPlane is inverted (character bits clear, 
  256. background bits set) into the InvertedTextPlane.  These two planes 
  257. of text are then used with two other pre-initialized planes, the 
  258. AllClearPlane plane of all bits clear and AllSetPlane plane of 
  259. all bits set, to create the text display.  
  260.  
  261. Using these four planes, one can construct a bitmap of all possible pen 
  262. settings for the foreground and background of the character imagery.  
  263. Consider this table of all possible combinations of corresponding bits 
  264. of the character and background colors:  
  265.  
  266.     Foreground  Background
  267.        Bit          Bit
  268.       -----        -----
  269.         0            0        Use AllClearPlane
  270.         0            1        Use InvertedTextPlane
  271.         1            0        Use NormalTextPlane
  272.         1            1        Use AllSetPlane
  273.  
  274. XText() plugs the plane pointers according to the above table into a 
  275. pre-initialized BitMap structure, and finally calls the graphics 
  276. library's BltBitMapRastPort() function to move the text into the 
  277. destination raster.  BltBitMapRastPort() works both with Intuition 
  278. windows and with rastports that have no associated layer 
  279. ("roll your own" rasters).
  280.  
  281. Actually, when the drawing mode is JAM1 the text must be "cookie cut" 
  282. into the background by using the NormalTextPlane as a mask for a call 
  283. to (grit your teeth here) BltMaskBitMapRastPort().  Because an extra 
  284. blitter source and extra handling is required by this routine, 
  285. performance is noticeably degraded.  Avoid JAM1 where possible.
  286.  
  287. In any event, with so many of the pieces pre-initialized and with the 
  288. blitter whipped into a font frenzy, perhaps you can understand why 
  289. these routines work reasonably fast.
  290.  
  291. Note that if the foreground and background pens are equal, the normal 
  292. and inverted planes don't need to be constructed as they'll never be 
  293. used.  An optimization that evolves out of this fact is that you can 
  294. fill a line or part of a line of your text with spaces (blank 
  295. characters) much more quickly by setting the foreground pen equal to 
  296. the background pen.  The trick with this optimization is to not spend 
  297. too much time detecting whether or not an area of text is all blank, 
  298. for you may lose the increased performance during the handling of 
  299. normal text lines.
  300.  
  301. Actually, if the foreground and background pens are equal and therefore 
  302. a blank line will be output, it would be much more efficient to skip 
  303. all of this work and call the graphics library's RectFill() routine.  
  304. This is left as an exercise for the reader.
  305.  
  306. A further optimization:  I'm guessing that many text calls will not 
  307. require the inverted plane, so it won't be made until it's needed.  
  308. If programmers follow the Intuition-encouraged standard of pen 1 for 
  309. foreground and pen 0 for background, then the bits are:    
  310.  
  311.     Foreground pen (in binary) -- 00001
  312.     Background pen (in binary) -- 00000
  313.  
  314.     Foreground  Background
  315.        Bit          Bit
  316.       -----        -----
  317.         0            0        Use AllClearPlane for plane 4
  318.         0            0        Use AllClearPlane for plane 3
  319.         0            0        Use AllClearPlane for plane 2
  320.         0            0        Use AllClearPlane for plane 1
  321.         1            0        Use NormalTextPlane for plane 0
  322.  
  323.  
  324. No need to invert here!  So the inverted plane would never be made.  
  325. In fact, if the text is *any* color against a background of zero, 
  326. this optimization works.  The cost of this technique is that I have 
  327. to check a flag once per time that I find an inverted bit plane is 
  328. called for (6 times maximum (though of course Dale would say 8 
  329. times maximum)), and the savings is in avoiding an unnecessary 
  330. inversion (big savings).
  331.  
  332. Because the blitter is word-size oriented, in order to use the blitter 
  333. most efficiently this routine always works with character pairs while 
  334. building the buffers.  This allows the blitter to always pick up two 
  335. characters, use a byte from each, and write a single word.  No extra 
  336. checking needs to be done, no special handling of the odd character.  
  337. If you specify an odd number of characters, this routine will round 
  338. up the character count to the next higher even number and then build 
  339. the buffer with that many characters.  However, only the number of 
  340. characters you specify will actually be printed to the screen.  The 
  341. overhead cost to process the extra character is nominal, while the 
  342. performance improvement gained by using the blitter and skipping the 
  343. overhead is great.  
  344.  
  345.  
  346. The XText font imagery is laid out in one of two ways, depending on 
  347. whether you want fast fat XText or slow slim XText.  The fast fat 
  348. technique runs about 20% faster than the slow and slim.  Also, 
  349. fast fat XText uses twice as much memory as the slow slim way, 
  350. typically 4K of CHIP RAM for each algorithmic style as compared 
  351. with 2K.  You might be willing to expend the extra memory if you 
  352. want the extra performance.  You specify that you want the slimmer 
  353. XText by passing SLIM_XTEXT as one of the flags that you supply to 
  354. the MakeXTextSupport() routine.
  355.  
  356. The fast fat XText technique is penny foolish but pound wise 
  357. (to mangle a cliche).  Again, one of the keys to this design is to 
  358. improve performance by leveraging off of the blitter's capabilities.  
  359. Each byte of character imagery is laid out in a word of memory where 
  360. the first byte contains the imagery and the second byte is blank.  
  361. Why spread the imagery out like this?  This allows the blitter to 
  362. always process two characters at a time, with the first character 
  363. loaded into the blitter's high byte and the second character 
  364. shifted right 8 bits into the low byte using the blitter's 
  365. delightfully fast barrel shifter.  The two characters are then laid 
  366. down in one stroke, thereby further minimizing computational overhead.  
  367.  
  368. The drawback of this fast fat technique is that it requires twice as 
  369. much memory as a normal font.  The formula for font requirement is:  
  370. 256 * character height * 2.  For example, to create an XText version 
  371. of topaz.font requires 256 characters * 8 rows * 2 bytes per row = 4096 
  372. bytes.  Do you think it's worth it?  
  373.  
  374. The slim technique uses the processor to build the text plane, so 
  375. there is no blitter requirement of using one word for each byte of 
  376. image data.  It's byte for byte, which cuts memory usage in half.  
  377. But using the processor takes much longer than using the blitter 
  378. to build the text plane, typically a total of 20% longer.  
  379.  
  380.  
  381.  
  382.  
  383. =============================================================================
  384. === XTEXT FUNCTION CALLS ====================================================
  385. =============================================================================
  386.  
  387. CONTENTS:
  388.    MakeXTextFont()
  389.    MakeXTextSupport()
  390.    UnmakeXTextSupport()
  391.    XText()
  392.  
  393.  
  394.  
  395.  
  396.  
  397. *** MakeXTextFont() ******************************************************
  398.  
  399.  
  400. NAME
  401.    MakeXTextFont  --  Make font imagery for the XText routines
  402.  
  403.  
  404. SYNOPSIS
  405.    UBYTE *MakeXTextFont(TextAttr, XTextSupport, Index);
  406.  
  407.  
  408. FUNCTION
  409.    This routine creates font imagery in the format that the XText()
  410.    routine uses.  It allocates the font data buffer and then constructs
  411.    the XText font imagery in this buffer using the imagery of the
  412.    font specified by the TextAttr argument.
  413.    
  414.    This routine is normally called by MakeXTextSupport().  You do not
  415.    need to use this routine unless you want to create fonts that
  416.    have special styles such as bold, underline, and italics.
  417.    
  418.    If all is successful, this routine writes the address of the font 
  419.    data buffer in the XTextSupport's FontData array at the Index position,
  420.    and returns the address of the new font data buffer.  
  421.    If anything goes wrong, the FontData array is unchanged and this 
  422.    routine returns NULL.
  423.    
  424.    You can specify font styles in your TextAttr structure.
  425.    If the TextAttr argument is equal to NULL, the system's 80-column 
  426.    "topaz.font" will be used instead.
  427.    
  428.    You must have called MakeXTextSupport() before calling this routine,
  429.    as this routine requires an initialized XTextSupport structure.
  430.    All memory allocations are attached to the XTextSupport structure's
  431.    Remember key.
  432.    
  433.    
  434. INPUTS
  435.    TextAttr = a pointer to a TextAttr structure specifying the font
  436.       to be used for this XText font imagery.  If the TextAttr
  437.       argument is equal to NULL, the system's 80-column "topaz.font"
  438.       will be used.
  439.    
  440.    XTextSupport = a pointer to an initialized XTextSupport structure,
  441.       which structure is created by a call to MakeXTextSupport().
  442.    
  443.    Index = index into the XTextSupport's FontData array for this font
  444.    
  445.    
  446. RESULT
  447.    Returns a pointer to the memory block that contains the font imagery.
  448.    If anything goes wrong (usually out of memory), returns NULL.
  449.    
  450.    
  451. EXAMPLE
  452.      struct XTextSupport *xtext;
  453.      struct TextAttr localTextAttr = { ... };
  454.      xtext = MakeXTextSupport(...);
  455.    [Make a BOLD font for XText() calls]
  456.      localTextAttr.ta_Style = FSF_BOLD;
  457.      MakeXTextFont(&localTextAttr, xtext, BOLD_FONT);
  458.    [Write some BOLD characters]
  459.      xtext->FontSelect = BOLD_FONT;
  460.      XText(...);
  461.  
  462. BUGS
  463.    Well, if there is a bug it's a highly technical one that most
  464.    of you can ignore.  I'm not sure that it's entirely 100% for sure 
  465.    safe to work with DiskfontBase the way I have below and still expect
  466.    this program to be re-entrant.  It should be OK up to and including 
  467.    the 1.2 release of the system, but in the future this could cause
  468.    some very mysterioso bug.
  469.    
  470.    
  471. SEE ALSO
  472.    MakeXTextSupport(), XText(), UnmakeXTextSupport()
  473.  
  474.  
  475.  
  476.  
  477.  
  478. *** MakeXTextSupport() ***************************************************
  479.  
  480. NAME
  481.    MakeXTextSupport  --  Allocate and initialize XText Support data
  482.  
  483.  
  484. SYNOPSIS
  485.    struct XTextSupport *MakeXTextSupport(RastPort, TextAttr, 
  486.          MaxTextWidth, InitialFlags);
  487.  
  488.  
  489. FUNCTION
  490.    This routine allocates an XTextSupport structure and initializes
  491.    the structure for use by the XText routines.
  492.  
  493.    The font specified by the TextAttr argument is opened.  If the
  494.    TextAttr arg is equal to NULL, the system font "topaz.font" is
  495.    opened instead.  If you are specifying a TextAttr, the font you
  496.    specify must have a character cel that is 8-bits wide.
  497.  
  498.    Image data from this font is then used to create the special
  499.    font data used by the XText routines.  The address of this data
  500.    is put in the FontData variable of the XTextSupport structure,
  501.    as well as in all of the elements in the SpecialFontData array.
  502.  
  503.    The MaxTextWidth argument describes the maximum number of 
  504.    characters that you will ever print at one time with the 
  505.    XText() routine.  Typically this number will be 80 or 40, 
  506.    depending on whether your display is high-res or low-res.  
  507.    This number should be an even number; if the number you 
  508.    supply is odd, the actual number used will be your number 
  509.    rounded up to the next even number.
  510.  
  511.    The InitialFlags argument is used to preset your XTextSupport's
  512.    Flags variable before anything is done with the structure.  
  513.    See the file xtext.h for the definitions of the XTextSupport 
  514.    structure's Flags.
  515.  
  516.    An InitialFlag of note is the SLIM_XTEXT flag, which you can 
  517.    set to define that you want the slim (and slow) XText technique 
  518.    to be used when the XText font data is created and when 
  519.    XText is rendered to the display.  The advantage of SLIM_XTEXT 
  520.    is that the technique requires half as much memory as the 
  521.    fast fat technique.  The disadvantage is that it runs about 
  522.    20% more slowly than fast fat XText.  
  523.  
  524.    After you have called MakeXTextSupport(), you can use
  525.    the Remember key in the XTextSupport structure -- named
  526.    XTextKey -- for further memory allocations.  All memory
  527.    allocations made using XTextKey are freed when 
  528.    UnmakeXTextSupport() is called.
  529.  
  530.  
  531. INPUTS
  532.    RastPort = a pointer to the RastPort that will be the destination
  533.       for text created by the XText routines.  Typically, this
  534.       will be the RastPort of an Intuition window or screen
  535.       that you've opened.  For an example, see EXAMPLE below.
  536.  
  537.    TextAttr = a pointer to a TextAttr structure specifying the font
  538.       to be used for this XText font imagery.  If the TextAttr
  539.       argument is equal to NULL, the system's 80-column "topaz.font"
  540.       will be used.
  541.  
  542.    MaxTextWidth = Maximum number of characters per line.  This should 
  543.       be an even number, and if odd will be rounded up to the 
  544.       next even number.
  545.  
  546.    InitialFlags = Flags that will be preset in your XTextSupport's
  547.       Flags variable before anything is done with the structure.  
  548.       See the file xtext.h for the definitions of the XTextSupport 
  549.       structure's Flags.
  550.  
  551.  
  552. RESULT
  553.    Returns the address of the XTextSupport structure, or NULL
  554.    if there were any problems (usually out of memory).
  555.  
  556.  
  557. EXAMPLE
  558.    window = OpenWindow( ... );
  559.    xtext = MakeXTextSupport(window->RPort, &DiskFontTextAttr, 80, NULL);
  560.    - or, as another example, open a 320 screen and ... -
  561.    screen = OpenScreen( ... );
  562.    xtext = MakeXTextSupport(&screen->RastPort, NULL, 40, SLIM_XTEXT);
  563.  
  564.  
  565. SEE ALSO
  566.    MakeXTextFont(), XText(), UnmakeXTextSupport()
  567.  
  568.  
  569.  
  570.  
  571.  
  572. *** UnmakeXTextSupport() *************************************************
  573.  
  574. NAME
  575.    UnmakeXTextSupport  --  Free the XTextSupport structure and buffers
  576.  
  577.  
  578. SYNOPSIS
  579.    UnmakeXTextSupport(XTextSupport)
  580.  
  581.  
  582. FUNCTION
  583.    Frees the XTextSupport structure and buffers.
  584.  
  585.  
  586. INPUTS
  587.    XTextSupport = pointer to an XTextSupport structure (typically
  588.               created by a call to MakeXTextSupport() )
  589.  
  590.  
  591. RESULT
  592.    None
  593.  
  594.  
  595. SEE ALSO
  596.    MakeXTextSupport()
  597.  
  598.  
  599.  
  600.  
  601.  
  602. *** XText() **************************************************************
  603.  
  604. NAME
  605.    XText  --  Write a line of text using the XText technique
  606.  
  607.  
  608. SYNOPSIS
  609.    XText(XTextSupport, Text, CharCount, XPos, YPos);
  610.  
  611.  
  612. FUNCTION
  613.    Writes a line of text using the parameters in the XTextSupport
  614.    structure.
  615.  
  616.    The Text argument points to a line of text.  This text doesn't have
  617.    to be null-terminated.  CharCount describes how many characters
  618.    of Text should be printed.
  619.  
  620.    The XPos and YPos values describe the top-left corner for the
  621.    text.  Note that this is different from the x and y coordinate
  622.    system used by the graphics library's Text() routine, where the
  623.    coordinates refer to the baseline of the text.
  624.  
  625.    Before calling this routine you can set the FrontPen, BackPen, 
  626.    DrawMode and FontSelect in your XTextSupport structure.
  627.    Also, there are several other initializations that you may wish
  628.    to perform with your support structure.  Refer to the
  629.    XText Programmer's Guide for more information.
  630.  
  631.  
  632. INPUTS
  633.    XTextSupport = Pointer to an XTextSupport structure (typically
  634.       created by a call to MakeXTextSupport() )
  635.  
  636.    Text = Pointer to the text that you want output.  This text
  637.       doesn't have to be null-terminated
  638.  
  639.    CharCount = The number of characters to be printed
  640.  
  641.    XPos, YPos = The position for the top-left corner of the output
  642.  
  643.  
  644. RESULT
  645.    None
  646.  
  647.  
  648. EXAMPLE
  649.    struct XTextSupport *xtext;
  650.    xtext = MakeXTextSupport(...);
  651.    xtext->FrontPen = 3;
  652.    xtext->BackPen = 2;
  653.    XText(xtext, "Hello World!", 12, 25, 87);
  654.  
  655.  
  656. SEE ALSO
  657.    MakeXTextSupport(), MakeXTextFont()
  658.  
  659.  
  660.  
  661.  
  662.